<?php
session_start();
if (!$_SESSION['logged_in']) {
    header('Location: login.php');
    exit;
}

if (isset($_GET['file'])) {
    $file = urldecode($_GET['file']);
    if (file_exists('articles/' . $file)) {
        unlink('articles/' . $file);
        echo "文章已删除！";
    } else {
        echo "文章不存在！";
    }
} else {
    echo "无效的请求！";
}

echo '<br><a href="admin.php">返回后台</a>';
?>
